import { Component, OnInit, Input } from '@angular/core';
import { AppGlobalService } from '../../shared/service/app-global.service'

@Component({
  selector: 'app-column-tag',
  templateUrl: './column-tag.component.html',
  styleUrls: ['./column-tag.component.scss']
})
export class ColumnTagComponent implements OnInit {
  // 传入数据
  @Input() tagData: any = {};
  ifcssType: any;
  img: any;

  constructor(private appGlobalService: AppGlobalService) {
    this.img = [{ text: '明火', iconUrl: 'http://wx2.sinaimg.cn/bmiddle/e16fc503gy1g0jn3f285ug206o06o4ee.gif' },
    { text: '明火', iconUrl: 'http://wx2.sinaimg.cn/bmiddle/e16fc503gy1g0jn3f285ug206o06o4ee.gif' },
    { text: '明火', iconUrl: 'http://wx2.sinaimg.cn/bmiddle/e16fc503gy1g0jn3f285ug206o06o4ee.gif' },
    { text: '明火', iconUrl: 'http://wx2.sinaimg.cn/bmiddle/e16fc503gy1g0jn3f285ug206o06o4ee.gif' },
    { text: '明火', iconUrl: 'http://wx2.sinaimg.cn/bmiddle/e16fc503gy1g0jn3f285ug206o06o4ee.gif' },
    { text: '明火', iconUrl: 'http://wx2.sinaimg.cn/bmiddle/e16fc503gy1g0jn3f285ug206o06o4ee.gif' },
    { text: '明火', iconUrl: 'http://wx2.sinaimg.cn/bmiddle/e16fc503gy1g0jn3f285ug206o06o4ee.gif' }]
  }

  ngOnInit() {
    if (this.tagData.cssType === '1') {
      this.ifcssType = true;
    } else if (this.tagData.cssType === '2') {
      this.ifcssType = false;
    }
  }

  jumpToPage(item) {
    // console.log(item)
    const sessionId = localStorage.getItem('sessionId');
    // tslint:disable-next-line:object-literal-shorthand
    const pageParams = { pageId: item.target, params: item.param ? item.param : {}, sessionId: sessionId };
    this.appGlobalService.goToForward(pageParams);
  }

}
